﻿using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class StartPanel : BasePanelUI
{
    public Button playButton;
    public Button selectLevelButton;

    public override void Init()
    {
        base.Init();
    }
    public override void BtnEvent()
    {
        base.BtnEvent();







        playButton.onClick.AddListener(() =>
    {
        SoundManager.Instance.PlayAudio(SoundType.Click.ToString(), false);
        if (GameCtrl.Instance.maxLevelId >= GameCtrl.Instance.levelDataList.Count)
        {
            Hide();
            GameCtrl.Instance.levelPanel.Show();

            return;
        }
        GameCtrl.Instance.playPanel.Show(GameCtrl.Instance.maxLevelId);
        Invoke("HideStartPanel", 1);


    });

        selectLevelButton.onClick.AddListener(() =>
        {
            SoundManager.Instance.PlayAudio(SoundType.Click.ToString(), false);
            Hide();
            GameCtrl.Instance.levelPanel.Show();
        });
    }

    private void HideStartPanel()
    {
        Hide();
    }

    private void ShowVersionText()
    {
    }

    public override void Show()
    {
        base.Show();
    }
}
